Skip to content

feat(webapi): saveScreenshot with custom path#5469

Open
kobenguyent wants to merge 149 commits into
4.xfrom
feat/custom-screenshot-path
Open

feat(webapi): saveScreenshot with custom path#5469
kobenguyent wants to merge 149 commits into
4.xfrom
feat/custom-screenshot-path

Conversation

@kobenguyent
Copy link
Copy Markdown
Collaborator

@kobenguyent kobenguyent commented Mar 4, 2026

Motivation/Description of the PR

  • Description of this PR, which problem it solves
  • Resolves #issueId (if applicable).

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium
  • TestCafe

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

dependabot Bot and others added 30 commits July 16, 2025 09:36
Bumps [playwright](https://github.com/microsoft/playwright) from 1.53.0 to 1.54.1.
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.53.0...v1.54.1)

---
updated-dependencies:
- dependency-name: playwright
  dependency-version: 1.54.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.31.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [expect](https://github.com/jestjs/jest/tree/HEAD/packages/expect) from 29.7.0 to 30.0.4.
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v30.0.4/packages/expect)

---
updated-dependencies:
- dependency-name: expect
  dependency-version: 30.0.4
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.10.0 to 16.11.0.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](graphql/graphql-js@v16.10.0...v16.11.0)

---
updated-dependencies:
- dependency-name: graphql
  dependency-version: 16.11.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [electron](https://github.com/electron/electron) from 37.1.0 to 37.2.3.
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](electron/electron@v37.1.0...v37.2.3)

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 37.2.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [axios](https://github.com/axios/axios) from 1.8.4 to 1.11.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.8.4...v1.11.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [typedoc-plugin-markdown](https://github.com/typedoc2md/typedoc-plugin-markdown/tree/HEAD/packages/typedoc-plugin-markdown) from 4.7.0 to 4.7.1.
- [Release notes](https://github.com/typedoc2md/typedoc-plugin-markdown/releases)
- [Changelog](https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/packages/typedoc-plugin-markdown/CHANGELOG.md)
- [Commits](https://github.com/typedoc2md/typedoc-plugin-markdown/commits/typedoc-plugin-markdown@4.7.1/packages/typedoc-plugin-markdown)

---
updated-dependencies:
- dependency-name: typedoc-plugin-markdown
  dependency-version: 4.7.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [browser-actions/setup-chrome](https://github.com/browser-actions/setup-chrome) from 1 to 2.
- [Release notes](https://github.com/browser-actions/setup-chrome/releases)
- [Changelog](https://github.com/browser-actions/setup-chrome/blob/master/CHANGELOG.md)
- [Commits](browser-actions/setup-chrome@v1...v2)

---
updated-dependencies:
- dependency-name: browser-actions/setup-chrome
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.28.7 to 0.28.10.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](TypeStrong/typedoc@v0.28.7...v0.28.10)

---
updated-dependencies:
- dependency-name: typedoc
  dependency-version: 0.28.10
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: hook exit code

* Update asyncWrapper.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update asyncWrapper.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update asyncWrapper.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update asyncWrapper.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update asyncWrapper.js

* Update asyncWrapper.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tsd](https://github.com/tsdjs/tsd) from 0.32.0 to 0.33.0.
- [Release notes](https://github.com/tsdjs/tsd/releases)
- [Commits](tsdjs/tsd@v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: tsd
  dependency-version: 0.33.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [typedoc-plugin-markdown](https://github.com/typedoc2md/typedoc-plugin-markdown/tree/HEAD/packages/typedoc-plugin-markdown) from 4.7.1 to 4.8.1.
- [Release notes](https://github.com/typedoc2md/typedoc-plugin-markdown/releases)
- [Changelog](https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/packages/typedoc-plugin-markdown/CHANGELOG.md)
- [Commits](https://github.com/typedoc2md/typedoc-plugin-markdown/commits/typedoc-plugin-markdown@4.8.1/packages/typedoc-plugin-markdown)

---
updated-dependencies:
- dependency-name: typedoc-plugin-markdown
  dependency-version: 4.8.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* release 3.7.4
…Timeout` value at the end of test suite (#5077)

* Initial plan

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
* Initial plan

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
#5082)

* Initial plan

* Fix JUnit XML test case name inconsistency in scenario retries

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Improve edge case handling for empty suite titles in cloned tests

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
* fix: TestCafe_test.js

* Fix TestCafe form submission timeout with efficient polling mechanism (#5080)

* Initial plan

* Fix failed TestCafe tests by skipping doubleClick test

* Update testcafe.yml

* Update testcafe.yml

* Update TestCafe_test.js

* Update TestCafe_test.js

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Fix TestCafe form submission timeout in CI environments

* Improve TestCafe form submission timeout handling with polling mechanism

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Improve TestCafe form submission timeout with efficient polling mechanism

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Update testcafe.yml

* fix: Chrome popup causes problems with TestCafe

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
Co-authored-by: kobenguyent <kobenguyent@gmail.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
* Initial plan

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Add TypeScript types for Feature.only method

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Fix TypeScript test expectations for hook return types

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
* Initial plan

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@DavertMik DavertMik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just split filename path and create folders automatically?

I.saveScreenshot('custom/debug.png') will create output/custom/debug.png

@kobenguyent
Copy link
Copy Markdown
Collaborator Author

Can we just split filename path and create folders automatically?

I.saveScreenshot('custom/debug.png') will create output/custom/debug.png

I may get it wrongly as #5404 request may try to save the screenshot to custom path not inside the output folder.

@DavertMik
Copy link
Copy Markdown
Contributor

@kobenguyent we can use absolute paths to handle this

if provided path is absolute -> save into it

so use could use it like this:

I.saveSceenshot(path.join(global.mySpecialPath, 'screenshot1'))

I dont see a need for another very similar method
it will be confusing to users and AI agents

Just detect global paths and provide such solution in UI
If user wants different ways they can create their own similar methods like

I.saveScreenshotToMyPath()
I.saveScreenshotToMyOtherPath()

inside custom steps file

@kobenguyent
Copy link
Copy Markdown
Collaborator Author

I see. Initially, I was thinking to reimplement the same function but I thought it may be backwards compatibility so that's why I introduced the new one.

@kobenguyent kobenguyent changed the title feat(webapi): saveScreenshotToPath feat(webapi): saveScreenshot with custom path Mar 11, 2026
Comment thread lib/utils.js Outdated
Comment thread docs/helpers/Playwright.md
Comment thread docs/webapi/saveScreenshot.mustache Outdated
Comment thread test/helper/webapi.js Outdated
@kobenguyent kobenguyent requested a review from DenysKuchma March 18, 2026 14:23
@kobenguyent kobenguyent requested a review from thomashohn March 18, 2026 14:27
@kobenguyent kobenguyent changed the base branch from 3.x to 4.x May 26, 2026 03:41
@kobenguyent
Copy link
Copy Markdown
Collaborator Author

@copilot resolve conflicts with main branch (4.x)

Copilot AI added 2 commits May 26, 2026 03:59
- Resolve all merge conflicts, accepting 4.x as base
- Retain feature: screenshotOutputFolder now supports absolute paths
  and relative subdirectory paths (e.g. 'custom/debug.png' -> output/custom/debug.png)
- Use path.isAbsolute() for cross-platform compatibility
- Create subdirectories automatically when output dir exists
- Update tests and docs to reflect new behavior
Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

@copilot resolve conflicts with main branch (4.x)

Resolved conflicts with the 4.x branch in commit d45bf56. Key changes during the merge:

  • All merge conflicts resolved, using 4.x as the base (ES modules, store.outputDir)
  • Updated screenshotOutputFolder in lib/utils.js to use path.isAbsolute() for cross-platform path detection (addresses @DenysKuchma's Windows/POSIX concern)
  • Absolute paths save directly to the given location: I.saveScreenshot(path.join(myPath, 'debug.png'))
  • Relative paths with subdirectories save inside the output folder with auto-created subdirs: I.saveScreenshot('custom/debug.png')output/custom/debug.png
  • Removed the separate saveScreenshotToPath method as requested by @DavertMik
  • Removed 3.x-only CommonJS test files incompatible with 4.x ES module setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.